<?php 
class MysqlConnector { 
	private $_isConnected = false;
	private $link;
	
	public function connect() { 
		if(!$this->_isConnected) {
			$this->_isConnected = true;
			$this->link = mysql_connect(DB_IP, DB_UNAME, DB_UPASS) or die ('WTF '.mysql_error());
			mysql_select_db(DB_NAME) or die (mysql_error());
		}
	} 
	
	public function isConnected() { 
		return $this->_isConnected;
	} 
	
	public function disconnect() { 
		if($this->_isConnected){
			$this->_isConnected = false;
			mysql_close($this->link);
		}
	}
} 